import request from '@/plugin/axios'

export function fetchList (query) {
  return request({
    url: '/client/list/page',
    method: 'get',
    params: query,
    loading: {
      type: 'nprogress',
      interval: 500
    }
  })
}

export function addObj (obj) {
  return request({
    url: '/client/insert',
    method: 'post',
    data: obj
  })
}

export function getObj (id) {
  return request({
    url: '/client/get/' + id,
    method: 'get'
  })
}

export function batchDelObj (ids) {
  return request({
    url: '/client/delete/batch',
    method: 'delete',
    data: ids
  })
}

export function delObj (id) {
  return request({
    url: '/client/delete/' + id,
    method: 'delete'
  })
}

export function putObj (obj) {
  return request({
    url: '/client/update',
    method: 'put',
    data: obj
  })
}

export function getTreeData (id) {
  return request({
    url: '/user/userWithDept?deptId=' + id,
    method: 'get'
  })
}

export function importData (obj) {
  return request({
    url: '/client/importBatch',
    method: 'post',
    data: obj
  })
}

export function assignData (obj) {
  return request({
    url: '/client/allocation',
    method: 'post',
    data: obj
  })
}

export function assignData4Manual (obj) {
  return request({
    url: '/client/assign',
    method: 'post',
    data: obj
  })
}

export function getAassignList () {
  return request({
    url: '/user/getUsersByDept',
    method: 'get'
  })
}

export function insertBookingByClientId (obj) {
  return request({
    url: '/booking/insertBookingByClientId',
    method: 'post',
    data: obj
  })
}

export function batchMoveSellData (obj) {
  return request({
    url: '/client/moveData',
    method: 'put',
    data: obj
  })
}

export function getSuccessCountByUserId () {
  return request({
    url: '/client/getSuccessCountByUserId',
    method: 'get'
  })
}

